home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
WORDMISC
/
WPUTIL.LZH
/
WP5XASCE.ARC
/
WP5XASCE.8
next >
Wrap
Text File
|
1988-07-06
|
11KB
|
250 lines
; HELP.COM by Bob Montgomery, 2/23/87
; This program is a generic help screen template for use with the A86
; assembler. The desired help message is written as db's at Hlpst in
; place of the test message that is there now. The only restrictions
; on the help message are:
; 1. The message must not exceed 80 characters wide.
; 2. The message must not exceed 25 lines long.
; 3. Each help line must be the same length.
; The program will auto center the message on the display screen. The hot
; key combo to bring up the help screen is defined as Hotkey below (set
; for Cntl-Leftshift right now) and can be changed to another combination
; by changing the equate for Hotkey.
jmp Init ;Initialize program
Esc equ 1Bh
Vidmem equ 0B800 ;Location of screen 0
Monomem equ 0B000 ;Location of mono screen
BWattr equ 70h ;Grey background, black foreground
; Bits in shift status
Rtsh equ 1
Lftsh equ 2
Cntl equ 4
Alt equ 8
Scrl equ 10h
Numl equ 20h
Capl equ 40h
Mode db ? ;Current video mode
Vpage db ? ;Current video page
Vidseg dw ? ;Current page segment
Hlpflg db 0 ;1 => Help on
Attr db ? ;Attribute to use
Cursor dw ? ;Current cursor type
; =================================================================
; This is the VEdit Plus help message to be displayed in blue on white
; when Cntl-Left Shift pressed. 74 char X 25 lines screen size.
Colattr equ 71h ;White background, blue foreground
Hotkey equ Cntl+Lftsh ;Cntl-Left Shift key combo brings up screen
Hlpst: db '███████████WordPerfect 5.0 extended ASCII character printer map key█████████████'
Linchr equ $-Hlpst ;Chars on each help line
db '███╔═Asc═══Map═╤═Asc════Map═╤═Asc═══Map═╤═Asc═══Map═╤═Asc═══Map═╤═Asc═══Map═╗███'
db '███║128 Ç 1,38 │150 û 1,69 │172 ¼ 4,18 │194 ┬ 3,15 │216 ╪ 3,47 │238 ε 8,11 ║███'
db '███║129 ü 1,71 │151 ù 1,73 │173 ¡ 4,7 │195 ├ 3,14 │217 ┘ 3,12 │239 ∩ 6,17 ║███'
db '███║130 é 1,41 │152 ÿ 1,75 │174 « 4,9 │196 ─ 3,8 │218 ┌ 3,10 │240 ≡ 6,15 ║███'
db '███║131 â 1,29 │153 Ö 1,62 │175 » 4,10 │197 ┼ 3,18 │219 █ 3,3 │241 ± 6,1 ║███'
db '███║132 ä 1,31 │154 Ü 1,71 │176 ░ 3,0 │198 ╞ 3,38 │220 ▄ 3,7 │242 ≥ 6,3 ║███'
db '███║133 à 1,33 │155 ¢ 4,19 │177 ▒ 3,1 │199 ╟ 3,42 │221 ▌ 3,4 │243 ≤ 6,2 ║███'
db '███║134 å 1,35 │156 £ 4,11 │178 ▓ 3,2 │200 ╚ 3,24 │222 ▐ 3,6 │244 ⌠ 7,0 ║███'
db '███║135 ç 1,39 │157 ¥ 4,12 │179 │ 3,9 │201 ╔ 3,21 │223 ▀ 3,7 │245 ⌡ 7,1 ║███'
db '███║136 ê 1,43 │158 ₧ 4,13 │180 ┤ 3,16 │202 ╩ 3,28 │224 α 8,1 │246 ÷ 6,8 ║███'
db '███║137 ë 1,45 │159 ƒ 4,14 │181 ╡ 3,41 │203 ╦ 3,26 │225 ß 8,3 │247 ≈ 6,13 ║███'
db '███║138 è 1,47 │160 á 1,27 │182 ╢ 3,27 │204 ╠ 3,25 │226 Γ 8,6 │248 ° 4,1 ║███'
db '███║139 ï 1,53 │161 í 1,49 │183 ╖ 3,35 │205 ═ 3,54 │227 π 8,33 │249 ∙ 4,0 ║███'
db '███║140 î 1,51 │162 ó 1,59 │184 ╕ 3,31 │206 ╬ 3,29 │228 Σ 8,37 │250 · 4,3 ║███'
db '███║141 ì 1,55 │163 ú 1,67 │185 ╣ 3,27 │207 ╧ 3,45 │229 σ 8,37 │251 √ 7,4 ║███'
db '███║142 Ä 1,30 │164 ñ 1,57 │186 ║ 3,20 │208 ╨ 3,41 │230 µ 8,25 │252 ⁿ 4,21 ║███'
db '███║143 Å 1,34 │165 Ñ 1,56 │187 ╗ 3,22 │209 ╤ 3,43 │231 τ 8,41 │253 ² 4,20 ║███'
db '███║144 É 1,41 │166 ª 4,15 │188 ╝ 3,23 │210 ╥ 3,39 │232 Φ 8,44 │254 ■ 4,2 ║███'
db '███║145 æ 1,37 │167 º 4,16 │189 ╜ 3,36 │211 ╙ 3,37 │233 Θ 8,16 │255 NotMapd║███'
db '███║146 Æ 1,36 │168 ¿ 4,8 │190 ╛ 3,32 │212 ╘ 3,33 │234 Ω 8,51 ├───────────╢███'
db '███║147 ô 1,61 │169 ⌐ 5,16 │191 ┐ 3,11 │213 ╒ 3,30 │235 δ 8,11 │ Syntax: ║███'
db '███║148 ö 1,63 │170 ¬ 5,17 │192 └ 3,13 │214 ╓ 3,34 │236 ∞ 6,19 │Ctrl V n,nn║███'
db '███║149 ò 1,65 │171 ½ 4,17 │193 ┴ 3,17 │215 ╫ 3,46 │237 φ 8,45 │n,nn = Map ║███'
db '███╚═══════════╧════════════╧═══════════╧═══════════╧═══════════╧═══════════╝███'
; ====================================================================
Msglen equ $-Hlpst ;# chars in help buffer
Lines equ Msglen/Linchr ;# lines of help
Buflen equ 2*Msglen ;Screen data buffer length
Stlin equ (25-Lines)/2 ;Start line
Stchr equ (80-Linchr)/2 ;Start byte on line
Stscr equ 160*Stlin + 2*Stchr ;Start of mem to put help
Scrbuf: db Buflen dup (?) ;Buffer for screen data
; New Int 9 routine - check for Cntrl-LShift; ignore others.
; Since Int 9 is called every time a key is pressed or released, and
; reads the keyboard thru some mysterious means in BIOS, we must call
; the old Int 9 as a subroutine each time an Int 9 is generated. But,
; an interrupt routine has a IRET instead of a RET as the return
; instruction, which pops the return address like a RET does, and then
; pops the flags. So to call Int 9 like a subroutine, we have to push
; the flags first; then when the the IRET is executed, control returns
; to our program with the stack pointer at the right place.
Start: push ax,bx,cx,dx,ds,es,di,si ;Save all for calling program
pushf ;Put flags on stack since Int pops flags
Oldint: call 0000:0000 ;Call old Int 9 to get key-will pop flags
mov ah,2 ;Get shift status
Int 16h ;in al
and al,Hotkey ;Only keep Hot keys
cmp al,Hotkey ;Were both pressed?
jne Exit ;No
mov ds,cs ;Yes, set ds=cs
cmp Hlpflg,1 ;Is help already up?
jne Go ;No, put it up
; If help is already up, ignore the Hotkey.
Exit: pop si,di,es,ds,dx,cx,bx,ax ;Restore all for calling program
iret ;Pop return address and flags
; Come here if should put up help.
Go: mov al,Colattr ;Assume color
mov Attr,al
mov ah,15 ;Get video mode in al
int 10h ;and page in bh
mov Mode,al ;Save Mode
mov Vpage,bh ;and page
cmp al,2 ;Mode=2?
je Color ;Yes
cmp al,3 ;Mode=3?
je Color ;Yes
cmp al,7 ;Mode=7? (mono)
jne Exit ;No, must be graphics so exit
mov al,BWattr ;Set B&W attribute
mov Attr,al
mov bx,Monomem ;and start of mono video memory
jmp short A0
Color: mov bl,0 ;Bx=256*display page
add bx,Vidmem ;Get display mem segment
A0: mov ds,bx ;in ds
; Put up help screen.
; First save current screen to buffer.
call Hidecur ;Hide cursor
call Vidoff ;Disable video (avoids snow on CGA)
mov dl,Lines ;Get # lines of help
mov es,cs ;es=cs
mov si,Stscr ;ds:si points to help screen area in disp mem
mov di,Scrbuf ;es:di points to buffer for screen data
push si,es,ds ;Save them
mov ch,0 ;ch=0
mov cl,Linchr ;cx=chars/help line
A1: push si,cx ;Save position in scrn mem & chars/line
cld ;Set to inc si & di
rep movsw ;Move screen to buffer
pop cx,si ;Get start of line & chars/line
add si,160 ;Next line, same column
dec dl ;Done all lines?
jne A1 ;No
; Now put up help.
pop es,ds,di ;Now ds=cs, es:di=help scrn area in screen mem
push di,ds,es ;Put back in orig order
mov si,Hlpst ;Point si to help data
mov dl,Lines ;Get chars/help line
mov ah,Attr ;Get char attribute (color)
B1: push di,cx ;Save disp mem pos & chars/help line
B2: lodsb ;Get a help char in al
stosw ;Save char & attribute in screen mem
loop B2 ;Do whole line
pop cx,di ;Get start of disp line & chars/line
add di,160 ;Next line, same column
dec dl ;Done all lines?
jne B1 ;No
mov Hlpflg,1 ;Yes, indicate help up
call Vidon ;and enable video
; Now, wait for the escape key; come here after each keypress (Int 9).
Wait1: mov ah,0 ;Wait for a key
int 16h
cmp al,Esc ;Was it Escape?
jne Wait1 ;No
; If Esc was pressed, put the old screen back
pop es,ds,di ;ds=cs; es:di=start of help area in disp mem
mov si,Scrbuf ;Point to old screen data buffer
call Vidoff ;Disable video (avoid snow on CGA)
mov dl,Lines ;Chars/help line
C1: push di,cx ;Save scrn mem pointer & chars/line
rep movsw ;Move a line to scrn mem
pop cx,di ;Get start of line & chars/line
add di,160 ;Next line, same column
dec dl ;Done all lines?
jne C1 ;No
mov Hlpflg,0 ;Yes, clear flag
call Vidon ;Enable video
call Showcur ;Turn cursor back on
jmp Exit ;and return
; Sub to turn cursor off; come with ds=video.
Hidecur: push cx,ds
mov ds,cs ;ds=cs
mov ah,3 ;Get current cursor data
mov bh,Vpage ;for current page
int 10h
mov Cursor,cx ;Save cursor type
mov ch,20h ;Set cursor off
mov ah,1
int 10h
pop ds,cx
ret
; Sub to turn cursor on; come with ds=cs.
Showcur: mov cx,Cursor ;Set original cursor Type
mov bh,Vpage
mov ah,1
int 10h
ret
; Turn video off
Vidoff: cs cmp Mode,7 ;Mono?
je D0 ;Yes, skip wait for vert retrace
push ds,dx,ax
call Getmode ;Get current video mode byte
and al,0F7 ;Clear video enable bit
out dx,al ;Send to mode control port
pop ax,dx,ds
D0: ret
; Turn video on
Vidon: cs cmp Mode,7 ;Mono?
je E0 ;Yes, skip wait for vert retrace
push ds,dx,ax
call Getmode ;Get current video mode byte
or al,8 ;Set video enable bit
out dx,al ;Send to mode control port
pop ax,dx,ds
E0: ret
; Sub to wait for vertical retrace to avoid snow on CGA screen.
Vert: mov dx,3DAh ;CRT status port
F1: in al,dx ;Read status
test al,8 ;Vert retrace?
je F1 ;No
mov dx,3D8h ;Point to video mode port
ret ;Yes, return
Getmode: call Vert ;Wait for vert retrace
mov ax,40h ;Get video mode
mov ds,ax ;at 465h
mov al,b[65h]
ret ;and return
; Come here to install the program as the new Int 9 routine.
Init: mov ax,3509h ;Get current Int 9 vector
int 21h ;in es:bx
mov ds,cs ;this code
mov w[Oldint+1],bx ;Save it
mov w[Oldint+3],es
mov ax,2509h ;Set new Int 9 routine
mov dx,Start
int 21h
mov dx,Init ;Terminate and
int 27h ;stay resident